﻿namespace WMS6.Services
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.ServiceModel.Activation;
    using WMS6.BLL;
    using WMS6.Common;
    using WMS6.DataEntity;
    using WMS6.QueryEntity;

    [AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]
    public class RoleFunctionService : IRoleFunctionService
    {
        public string DeleteRoleAndRoleFunction(List<string> roleID, PubParasInfo pubParasInfo)
        {
            try
            {
                RoleFunctionBLL RoleFunction = new RoleFunctionBLL();
                return RoleFunction.DeleteRoleAndRoleFunction(roleID, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "BaseInfoService异常");
            }
            return null;
        }

        public DataSet GetAllFunctionList()
        {
            try
            {
                RoleFunctionBLL RoleFunction = new RoleFunctionBLL();
                return RoleFunction.GetAllFunctionList();
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "BaseInfoService异常");
            }
            return null;
        }

        public List<string> GetOperationByUserIDAndFunctionID(string userID, string functionID, PubParasInfo pubParasInfo)
        {
            try
            {
                RoleFunctionBLL RoleFunction = new RoleFunctionBLL();
                return RoleFunction.GetOperationByUserIDAndFunctionID(userID, functionID, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "RoleFunctionService异常");
            }
            return null;
        }

        public DataSet GetRoleAndRoleFunctionDataByRoleId(string roleId, PubParasInfo pubParasInfo)
        {
            try
            {
                RoleFunctionBLL RoleFunction = new RoleFunctionBLL();
                return RoleFunction.GetRoleAndRoleFunctionDataByRoleId(roleId, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "RoleFunctionService异常");
            }
            return null;
        }

        public DataSet GetRoleFunctionData(string id, string type, PubParasInfo pubParasInfo)
        {
            try
            {
                RoleFunctionBLL RoleFunction = new RoleFunctionBLL();
                return RoleFunction.GetRoleFunctionData(id, type, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "RoleFunctionService异常");
            }
            return null;
        }

        public DataSet GetRoleMenuData(string roleID, string currentWH, PubParasInfo pubParasInfo)
        {
            try
            {
                RoleFunctionBLL RoleFunction = new RoleFunctionBLL();
                return RoleFunction.GetRoleMenuData(roleID, currentWH, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "RoleFunctionService异常");
            }
            return null;
        }

        public DataSet GetWHDataByUserID(string userID, PubParasInfo pubParasInfo)
        {
            try
            {
                RoleFunctionBLL RoleFunction = new RoleFunctionBLL();
                return RoleFunction.GetWHDataByUserID(userID, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "BaseInfoService异常");
            }
            return null;
        }

        public string UpdateRoleFunctionAndOperationByRoleGID(string type, RoleInfo roleInfo, List<string> FunctionTrueList, List<string> FunctionFalseList, List<string> OperationTrueList, List<string> OperationFalseList, string strCopyName, PubParasInfo pubParasInfo)
        {
            try
            {
                RoleFunctionBLL RoleFunction = new RoleFunctionBLL();
                return RoleFunction.UpdateRoleFunctionAndOperationByRoleGID(type, roleInfo, FunctionTrueList, FunctionFalseList, OperationTrueList, OperationFalseList, strCopyName, pubParasInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "BaseInfoService异常");
            }
            return null;
        }
    }
}

